Fix #671: Missing newline at end of file should produce a warning#672
Fix #671: Missing newline at end of file should produce a warning#672glankk wants to merge 3 commits into
Conversation
|
All these stray |
I am not sure why the The |
Me neither. Passing less means that the newline would be missing and the other changes add it. That is kind of a flip-flop.
If fiddling with the trailing newline is necessary that seems like a possible source of issues for users of the library. |
The char arrays that are initialized with a string constant include a null terminator, which makes these test cases fail because they end with '\0' instead of '\n'.
I agree that it looks really ugly but it's not wrong. |
|
I also agree that it's a bit awkward to implement this in simplecpp, since it doesn't really distinguish between C and C++. |
Maybe we should something more explicit to highlight what we are doing and it doesn't look like we randomly added those. We should probably land #666 first which allows passing the actual sizes instead of just relying onto |
Of course we should write test code properly. If the newline is not included in the test code then it is not included.
It's not "ugly" to write test code properly. I understand now why you write I.e. if we have |
I want that we are able to find this UB. But we do need to distinguish C/C++ somewhere. I can see two options:
I think current solution sounds least ugly. |
| std::cerr << "portability: "; | ||
| break; | ||
| case simplecpp::Output::PORTABILITY_NO_EOF_NEWLINE: | ||
| std::cerr << "portability: "; |
There was a problem hiding this comment.
we could adjust main.cpp so that this output is only written if the filename extension is ".c".
No description provided.